<%@page import="com.qdu.impl.BookPageImpl"%>
<%@page import="java.util.ArrayList"%>
<%@page import="java.util.List"%>
    <%@page contentType="text/html" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<html>

    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
        <style type="text/css">
            <!--
            .cd {
                border-top-width: 1px;
                border-right-width: 1px;
                border-bottom-width: 1px;
                border-left-width: 1px;
                border-top-style: solid;
                border-right-style: none;
                border-bottom-style: none;
                border-left-style: solid;
                border-top-color: #9f9f9f;
                border-right-color: #9f9f9f;
                border-bottom-color: #9f9f9f;
                border-left-color: #9f9f9f;
                font-family: "宋体";
                font-size: 12px;
                color: #000000;
                text-align: center;
                padding-top: 5px;
            }
            .cd1 {
                border-top-width: 1px;
                border-right-width: 1px;
                border-bottom-width: 1px;
                border-left-width: 1px;
                border-top-style: solid;
                border-right-style: solid;
                border-bottom-style: none;
                border-left-style: none;
                border-top-color: #9f9f9f;
                border-right-color: #9f9f9f;
                border-bottom-color: #9f9f9f;
                border-left-color: #9f9f9f;
                font-family: "宋体";
                font-size: 12px;
                color: #000000;
                padding-top: 5px;
                text-align: center;
            }
            .cd2 {	border-top-width: 1px;
                   border-right-width: 1px;
                   border-bottom-width: 1px;
                   border-left-width: 1px;
                   border-top-style: solid;
                   border-right-style: solid;
                   border-bottom-style: none;
                   border-left-style: solid;
                   border-top-color: #9f9f9f;
                   border-right-color: #9f9f9f;
                   border-bottom-color: #9f9f9f;
                   border-left-color: #9f9f9f;
                   font-family: "宋体";
                   font-size: 12px;
                   color: #000000;
                   padding-top: 5px;
                   text-align: center;
            }
            body {
                background-image: url(/images/bg-0040.gif);
            }
            a:link {
                color: #000000;
                text-decoration: none;
            }
            a:visited {
                text-decoration: none;
                color: #000000;
            }
            a:hover {
                text-decoration: none;
                color: #000000;
            }
            a:active {
                text-decoration: none;
                color: #000000;
            }
            .h14 {
                font-family: "宋体";
                font-size: 14px;
                line-height: 20px;
                color: #999999;
            }
            -->
        </style>
        <script type="text/JavaScript">
            <!--
            function MM_preloadImages() { //v3.0
            var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
            var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
            if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
            }
            function ra()
            {
            document.form1.hidden3.value="ok";
            }

            function del()
            {
            document.form1.method.value="delbook";
            form1.submit();

            }
            
            function up()
            {
            if(document.form1.hidden3.value!="ok")
            {
            window.alert("请选择要操作的对象！");
            return false;
            }
            else{//alert("del");
            document.form1.method.value="up";
            form1.submit();
            }
            }
            //-->
        </script>
        <style type="text/css">
            <!--
            .STYLE19 {border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-style: solid; border-right-style: solid; border-bottom-style: none; border-left-style: none; border-top-color: #9f9f9f; border-right-color: #9f9f9f; border-bottom-color: #9f9f9f; border-left-color: #9f9f9f; font-family: "宋体"; font-size: 12px; color: #FF0000; padding-top: 5px; text-align: center; }
            #Layer1 {	position:absolute;
                      left:61px;
                      top:34px;
                      width:98px;
                      height:189px;
                      z-index:1;
            }
            .STYLE20 {color: #66CC33}
            -->
        </style>
    </head>
    
    <%
    String message = (String)request.getAttribute("message");
            if(message == null){
                            message = "";
            }
            if (!message.trim().equals("")){
                    out.println("<script language='javascript'>");
                    out.println("alert('"+message+"');");
                    out.println("</script>");
            }
            request.removeAttribute("message");

    %>

    <%String name=(String)session.getAttribute("name");
            if(name==null){
                    response.sendRedirect("admin/login.jsp");
            }
            else{
    %>
    <body >
        <table width="100%" height="100%" cellpadding="0" cellspacing="0">
            <tr>
                <td height="121" align="center" valign="top" bgcolor="#FFFFFF"><div align="left"><br>
                        <span class="black14">　<strong>当前位置:</strong>图书管理</span><br>
                    </div>
                    <table width="100%" cellpadding="0" cellspacing="0">

                        <TR bgcolor="#cccccc">
                            <TD align="center" bgColor=#ffffff><br>
                                <br>

                                <table width="100%" cellspacing="0" cellpadding="0" border="1"  >
                                    <tr>
                                        <td height="30" align="center" bordercolor="#669999" bgcolor="#99CCCC"><p>序号</p></td>
                                        <td height="30" align="center" bordercolor="#669999" bgcolor="#99CCCC">书名</td>
                                        <td height="30" align="center" bordercolor="#669999" bgcolor="#99CCCC">作者</td>
                                        <td height="30" align="center" bordercolor="#669999" bgcolor="#99CCCC">出版社</td>
                                        <td height="30" align="center" bordercolor="#669999" bgcolor="#99CCCC">价格</td>
                                        <td height="30" align="center" bordercolor="#669999" bgcolor="#99CCCC">分类</td>
                                        <td height="30" align="center" bordercolor="#669999" bgcolor="#99CCCC">光盘</td>
                                        <td height="30" align="center" bordercolor="#669999" bgcolor="#99CCCC">折率</td>
                                        <td height="30" align="center" bordercolor="#669999" bgcolor="#99CCCC">推荐程度</td>
                                        <td height="30" align="center" bordercolor="#669999" bgcolor="#99CCCC">库存</td>
                                        <td height="30" align="center" bordercolor="#669999" bgcolor="#99CCCC">类型</td>
                                        <td height="30" align="center" bordercolor="#669999" bgcolor="#99CCCC">增加时间</td>   
                                        <td height="30" align="center" bordercolor="#669999" bgcolor="#99CCCC">选择</td>
                                    </tr>

                                    <%   
                                          String sql="select count(*) from bookinformation";
                                          String sql2="select * from bookinformation order by book_id desc";
                                                          BookPageImpl pageutil = new BookPageImpl();  
                                                          pageutil.setEVERYPAGENUM(15);
                                                  int cou = pageutil.getMessageCount(sql); System.out.println("cou="+cou);		        
                                                  String page1=request.getParameter("page");System.out.println("page="+page);
                                                  if(page1==null){
                                                          page1="1";
                                                  }
                                                  session.setAttribute("busMessageCount", cou + "");
                                                  System.out.println("BusxlAction faf.getPage=" + page1);
                                                  session.setAttribute("busPage", page1);
                                                  List list = pageutil.getMessage(Integer.parseInt(page1),sql2); 
                                                  session.setAttribute("qqq", list);System.out.println("===== session.setAttribute(qqq, list)=======");
                                                  int pageCount = pageutil.getPageCount(); 
                                                  session.setAttribute("busPageCount", pageCount + ""); 
                                                      List list3=(ArrayList)session.getAttribute("qqq");
                                                      System.out.println("list3="+list3);
                                                      if(!list3.isEmpty()){
                                    %>

                                    <form name=form1 action="../BookManageServlet.jsp" method=post>
                                        <input type="hidden" name="jsp" value="pt"> <input type="hidden" name="hidden3" value="haha"><input type="hidden" name="method" value="delbook">
                                        <%
                                                  for(int i=0;i<list3.size();i++){
                                                      List list2 =(ArrayList)list3.get(i);System.out.println("list2="+list2);						       		     
                                        %>   
                                        <tr>
                                            <td  height="30" align="center" bordercolor="#669999" bgcolor="#FFFFFF"><%=i+1 %></td>
                                            <td  height="30" align="center" bordercolor="#669999" bgcolor="#FFFFFF"><a href="bookinfo.jsp?id=<%=list2.get(0).toString() %>" target="_blank"><%=list2.get(1).toString() %></a></td>
                                            <td height="30" align="center" bordercolor="#669999" bgcolor="#FFFFFF"><%=list2.get(2).toString() %></td>
                                            <td height="30" align="center" bordercolor="#669999" bgcolor="#FFFFFF"><%=list2.get(3).toString() %></td>
                                            <td height="30" align="center" bordercolor="#669999" bgcolor="#FFFFFF"><%=list2.get(4).toString() %></td>
                                            <td height="30" align="center" bordercolor="#669999" bgcolor="#FFFFFF"><%=list2.get(5).toString() %></td>
                                            <td height="30" align="center" bordercolor="#669999" bgcolor="#FFFFFF"><%=list2.get(6).toString() %></td>
                                            <td height="30" align="center" bordercolor="#669999" bgcolor="#FFFFFF"><%=list2.get(7).toString() %></td>
                                            <td height="30" align="center" bordercolor="#669999" bgcolor="#FFFFFF"><%=list2.get(8).toString() %></td>
                                            <td height="30" align="center" bordercolor="#669999" bgcolor="#FFFFFF"><%=list2.get(9).toString() %></td>
                                            <td height="30" align="center" bordercolor="#669999" bgcolor="#FFFFFF"><%=list2.get(10).toString() %></td>
                                            <td height="30" align="center" bordercolor="#669999" bgcolor="#FFFFFF"><%=list2.get(11).toString() %></td>
                                            <td height="30" align="center" bordercolor="#669999" bgcolor="#FFFFFF"><input type=checkbox name=choose   value=<%=list2.get(0).toString() %>></td>
                                        </tr>

                                        <%}%>
                                    </form> 

                                </table>
                            </TD>
                        </TR>
                        <
                            <td align="center" height="14" colspan="8" bordercolor="#5D8191" class="12txt18"><br>
                                <table align="center" width="550" cellpadding="0" cellspacing="0">
                                    <tr>
                                        <td align="center">
                                            <input type="button" name="button3" value="删除" onClick="del()">&nbsp;&nbsp;&nbsp;                           
                                        </td>
                                    </tr>
                                </table>
                            </td>
                        </tr>
                        <%}else{%>
                        <tr>
                            <td colspan=14 align=center>当前没有信息！</td>
                        </tr>
                        <%} %>

                    </table>
                    <br>
                    <br></TD>
            </TR>
        </table></td>
</tr>
</table>
</body>
<%} %>
</html>
